package com.cal.utms.action.maintenance;

import com.cal.utms.dao.maintenance.CustomerDaoImpl;
import com.cal.utms.dto.maintenance.CustomerEmailDto;
import com.cal.utms.model.maintenance.CustomerModel;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

public class CustomerEmailAction extends ActionSupport implements ModelDriven<CustomerEmailDto> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	CustomerDaoImpl accountDao = new CustomerDaoImpl();
	private CustomerEmailDto customerEmailDto = new CustomerEmailDto();
	private int customer_id;
	private boolean success;

	public String getEmailsByCustomer() {
		success = true;
		customerEmailDto.setCustomerEmailDtos(CustomerModel.createEmailBeans(accountDao.getEmailByCustomerId(customer_id)));
		return Action.SUCCESS;
	}

	@Override
	public CustomerEmailDto getModel() {
		return customerEmailDto;
	}

	public CustomerEmailDto getCustomerEmailDto() {
		return customerEmailDto;
	}

	public void setCustomerEmailDto(CustomerEmailDto customerEmailDto) {
		this.customerEmailDto = customerEmailDto;
	}

	public int getCustomer_id() {
		return customer_id;
	}

	public void setCustomer_id(int customer_id) {
		this.customer_id = customer_id;
	}

	public boolean isSuccess() {
		return success;
	}

	public void setSuccess(boolean success) {
		this.success = success;
	}

}
